//
//	 ______    ______    ______    
//	/\  __ \  /\  ___\  /\  ___\   
//	\ \  __<  \ \  __\_ \ \  __\_ 
//	 \ \_____\ \ \_____\ \ \_____\ 
//	  \/_____/  \/_____/  \/_____/ 
//
//	Powered by BeeFramework
//
//
//  IntroBoard.m
//  Pizza
//
//  Created by sendInfo on 2015-04-03.
//  Copyright (c) 2015年 sendInfo. All rights reserved.
//

#import "IntroBoard.h"
#import "RevealController.h"
#import "RevealViewController.h"
#import "HomeBoard.h"
#import "AppDelegate.h"
#pragma mark -

@implementation IntroM



@end

@implementation IntroCell
SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES )

- (void)dataDidChanged
{
    IntroM *m = self.data;
    BeeUIImageView *imgv = (BeeUIImageView*)$(@"imgv").view;
    imgv.image = m.img;
}
@end


@interface IntroBoard()
{
	//
}
@end

@implementation IntroBoard

SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES )

- (void)load
{
    
}

- (void)unload
{
    
}

#pragma mark - Signal

ON_CREATE_VIEWS( signal )
{
    
    self.navigationBarShown = NO;
    [self.back addTarget:self.navigationController.parentViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchUpInside];
    
    UIImageView *bgimg = [[UIImageView alloc] initWithFrame:self.bounds];
    bgimg.image = [UIImage imageNamed:@"home-bg"];
    [self.view addSubview:bgimg];
    [self.view sendSubviewToBack:bgimg];
    NSMutableArray *imgs = [[NSMutableArray alloc] initWithCapacity:0];
    for (int i = 0; i<10; i++) {
        
        IntroM *intrm = [IntroM new];
        intrm.index = [NSString stringWithFormat:@"%d",i+1];
        NSString *name = [[NSString alloc] initWithFormat:@"intro%d.jpg",i+1];
        UIImage *image = [UIImage imageFromString:name];
        intrm.img = image;
        [imgs addObject:intrm];
    }
    
    self.list.lineCount = 1;
    self.list.animationDuration = 0.25f;
    self.list.whenReloading = ^{
    
        self.list.total = imgs.count;
        for (BeeUIScrollItem *item in self.list.items) {
            
            item.size = CGSizeMake(self.bounds.size.width, self.bounds.size.height);
            item.clazz = [IntroCell class];
            item.data = [imgs safeObjectAtIndex:item.index];
        }
    
    };
    self.list.whenReloaded = ^
    {
       
        
        self.pager.numberOfPages = self.list.total;
        self.pager.currentPage = self.list.pageIndex;
    };
    self.list.whenStop = ^
    {
       
        
        self.pager.numberOfPages = self.list.total;
        self.pager.currentPage = self.list.pageIndex;
    };

    
}


@end
